Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IndeedBridge] Add new bridge #1166

Merged
merged 1 commit into from
Jun 22, 2019
Merged

[IndeedBridge] Add new bridge #1166

merged 1 commit into from
Jun 22, 2019

Conversation

logmanoriginal
Copy link
Contributor

@logmanoriginal logmanoriginal commented Jun 13, 2019

Implements a bridge for
https://www.indeed.com/ (or any of the local variants)

Features:

  • Takes a company name and returns a list of reviews and comments
  • Limit the maximum number of items to return (default: 20)
  • No upper limit on the number of items to return
  • Search by language code (45 options)
  • Supports detectParameters for any supported URL

Closes #1072

Any features missing?

@logmanoriginal logmanoriginal self-assigned this Jun 13, 2019
@logmanoriginal logmanoriginal mentioned this pull request Jun 13, 2019
10 tasks
Implements a bridge for
https://www.indeed.com/ (or any of the local variants)

Features:
- Takes a company name and returns a list of reviews and comments
- Limit the maximum number of items to return (default: 20)
- No upper limit on the number of items to return
- Search by language code (45 options)
- Supports detectParameters for any supported URL
@logmanoriginal logmanoriginal changed the title [WIP][IndeedBridge] Add new bridge [IndeedBridge] Add new bridge Jun 22, 2019
@logmanoriginal logmanoriginal merged commit 89e3da0 into RSS-Bridge:master Jun 22, 2019
@logmanoriginal logmanoriginal deleted the IndeedBridge branch June 22, 2019 16:50
@ludovicgir
Copy link

Hi @logmanoriginal, thanks a lot for the bridge 👍.
I had started the french version but was not sure about it so it is great you made it. Anyway, here was the try

`<?php

// Not finalized
class IndeedBridge extends BridgeAbstract {

// Contexts
const CONTEXT_REVIEW = 'Company Reviews';
const CONTEXT_GLOBAL = 'global';

// Global context parameters
const PARAM_LIMIT = 'limit';

// Review context parameters
const PARAM_REVIEW_COMPANY = 'company';

const MAINTAINER = 'ludo';
const NAME = 'Indeed Bridge';
const URI = 'https://www.indeed.com/companies';
const DESCRIPTION = 'Returns feeds for company reviews';
const CACHE_TIMEOUT = 86400; // 24 hours

const PARAMETERS = array(
	self::CONTEXT_REVIEW => array(
		self::PARAM_REVIEW_COMPANY => array(
			'name' => 'Company URL',
			'type' => 'text',
			'required' => true,
			'title' => 'Write the company review page URL',
			'exampleValue' => 'https://www.indeed.com/cmp/Tata/reviews'
		)
	),
	self::CONTEXT_GLOBAL => array(
		self::PARAM_LIMIT => array(
			'name' => 'Limit',
			'type' => 'number',
			'defaultValue' => -1,
			'title' => 'Specifies the maximum number of items to return (default: All)'
		)
	)
);

private $host = self::URI; // They redirect without notice :/
private $title = '';

public function getURI() {
	return $this->getInput(self::PARAM_REVIEW_COMPANY);

	return parent::getURI();
}


public function collectData() {
	$html = getSimpleHTMLDOM($this->getURI())
		or returnServerError('Failed loading contents!');

	$this->host = $html->find('link[rel="canonical"]', 0)->href;

	$html = defaultLinkTo($html, $this->host);

	$this->title = $html->find('meta[property="og:title"]', 0)->content;
	$limit = $this->getInput(self::PARAM_LIMIT);

	$this->collectReviewData($html, $limit);
	
}

private function collectReviewData($html, $limit) {
	$reviews = $html->find('[itemprop="review"]')
		or returnServerError('No reviews found');

	$isFirst = true; //to skip the first value
	foreach($reviews as $review) {
		
		if ($isFirst) {
			$isFirst = false;
			continue;
		}
		
		$item = array();
		
		$item['uri'] = $review->find('[data-tn-element="review-share-copylink"]', 0)->href;

		$title_comment = $review->find('div.cmp-review-title span', 0)->plaintext;
		$score = substr($review->find('div.cmp-ratingNumber', 0)->plaintext, 0, 1); // get rid of the decimals
		$location = $review->find('span.cmp-reviewer-job-location', 0)->plaintext;
		$author = $review->find('span.cmp-reviewer-job-title span', 0)->plaintext;
		
		$item['title'] = "{$score}/5 : {$title_comment}";
		
		$english_months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
		$french_months = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');	
		
		$pubdate = str_replace($french_months, $english_months,$review->find('span.cmp-review-date-created', 0)->plaintext);
		
		$item['timestamp'] = strtotime($pubdate);

		$description = $review->find('[itemprop="reviewBody"]', 0)->plaintext;
		
		$pros = $review->find('div.cmp-review-pro-text', 0)->plaintext;
		$cons = $review->find('div.cmp-review-con-text', 0)->plaintext;
		
		if ( $pros !== NULL && $cons !==NULL ) {$item['content'] = "<p>{$author} - {$location} </p> <p>{$description}</p> <p> '<b>+</b>' : {$pros}</p> <p> '<b>-</b>' : {$cons}</p>";}
		else {$item['content'] = "<p>{$author} - {$location} </p> <p>{$description}</p>";}

		$this->items[] = $item;

		if($limit > 0 && count($this->items) >= $limit)
			return;
	}
}

}
`

@logmanoriginal
Copy link
Contributor Author

Thanks for your feedback!

I had started the french version but was not sure about it

Your bridge looks good to me 👍
Please don't hesitate to open PRs (add "[WIP]" to the title if it's still in the making).
That way we can discuss questions and suggest changes.

@gerroon
Copy link

gerroon commented Feb 19, 2020

@logmanoriginal

Can it create Rss feed for custom job search on Indeed?

infominer33 pushed a commit to web-work-tools/rss-bridge that referenced this pull request Apr 17, 2020
Implements a bridge for
https://www.indeed.com/ (or any of the local variants)

Features:
- Takes a company name and returns a list of reviews and comments
- Limit the maximum number of items to return (default: 20)
- No upper limit on the number of items to return
- Search by language code (45 options)
- Supports detectParameters for any supported URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indeed.com Company Reviews
3 participants